from django.db import models
from MD_django.settings import *
# Create your models here.

class FenLei(models.Model):
    name = models.CharField(max_length=32,verbose_name="种类")

class Goods(models.Model):
    name = models.CharField(max_length=32,verbose_name="商品名称")
    price = models.IntegerField(verbose_name="商品价格")
    content = models.CharField(max_length=512,verbose_name="简介",null=True)
    img = models.ImageField(null=True,verbose_name="商品图片")
    detll = models.TextField(max_length=520,verbose_name="商品信息",null=True)
    fenlei = models.ForeignKey(FenLei,on_delete=models.CASCADE,null=True)

class Class(models.Model):
    name = models.CharField(max_length=32)

class Computer(models.Model):
    name = models.CharField(max_length=32,verbose_name="电脑名称")
    price = models.IntegerField(verbose_name="电脑价格")
    img= models.ImageField(null=True,verbose_name="电脑图片")
    size = models.IntegerField(verbose_name="显示器尺寸",null=True)
    guige = models.IntegerField(verbose_name="处理器规格",null=True)
    clas = models.ForeignKey(Class,models.CASCADE,null=True)

class User(models.Model):
    username = models.CharField(max_length=32)
    user_level = models.IntegerField(default=1)
    score = models.IntegerField()

class XinWen(models.Model):
    title = models.CharField(max_length=32)
    content = models.CharField(max_length=520)
    user = models.ForeignKey(User,on_delete=models.CASCADE)









